
 * date: 29/01/2019 
 
 cd  \\Mac\Home\Desktop\BSG_Job_Sat
 

use  JobSatisfaction_raw_file, replace
* preserve 
* tempfile new_extracmigration_20190106 
save JobSatisfaction_active_file, replace   



****************************************************************************  
// Job satisfaction 

 
gen SatOverall =Q69_Line1-1 	//  Overall SWB/happiness  		
replace SatOverall =. if SatOverall <=0  	
 	 
	 
label define Statlabel 1 "Very unsatisfied" 2 "Unsatisfied" 3 "Neither" 4 "Satisfied" 5 "Very satisfied", replace
label values SatOverall Statlabel 	 
	 
 
generate SatIncome = Q66_Line1	// Job satisfaction. - Current income.
replace SatIncome  =. if SatIncome  ==1 
replace SatIncome  =SatIncome  -1 

generate SatSkill = Q66_Line2	// Job satisfaction. - Skill acquisition. 
replace SatSkill =. if SatSkill ==1 
replace SatSkill  = SatSkill -1
 
generate SatPotent  = Q66_Line3	// Job satisfaction. - Potential realization. 
replace SatPotent =. if SatPotent ==1 
replace SatPotent  = SatPotent -1
 

generate SatWork =Q66_Line4	// Job satisfaction. - Working condition.
replace SatWork =. if SatWork ==1 
replace SatWork  =SatWork -1
 
generate SatJobOverall= Q66_Line5	//Job satisfaction. - Overall satisfaction.
replace SatJobOverall =. if SatJobOverall ==1 
replace SatJobOverall =SatJobOverall -1

label values SatIncome  Statlabel 
label values SatSkill  Statlabel 
label values SatPotent  Statlabel 
label values SatWork  Statlabel  
label values SatJobOverall Statlabel 


tab(SatOverall)
tab(SatIncome ) 
tab(SatSkill ) 
tab(SatPotent ) 
tab(SatWork ) 
tab(SatJobOverall ) 

*************************************************************************** 
// work 

gen wh=real(Q61_Blank1 )  // working hours per day 
 
replace wh=. if wh> 16

summarize wh  



gen wd = real(Q60_Blank1)  // number of working days per week 


replace wd=. if wd>7 

summarize wd 


****************************************************************************  
// social network 
 
gen job_num= real(Q63_Blank1 )

summarize job_num 

gen job_ref =  real(Q64_Blank1) 

sum job_ref 

gen PerRef = job_ref / job_num 

summarize PerRef

replace PerRef=. if PerRef>1  // percentage of jobs obtained based on friends referral 




 





****************************************************************************  

// Personal information 


// sex - Sex 

* drop sex 
gen sex=1   
replace sex=0 if Q1==2  // record male - 1; female - 0. 
summarize(sex)  


// age -  generate age by the December 2018 

gen year=Q2_Blank1

* summarize(year) 
gen month=Q2_Blank2
 
* summarize(month)
gen age=2018-year+(12-month)/12  
* summarize(age)  
drop year 
drop month 

summarize(age) 

* replace age=. if age<=16 // minimum age required to work in China 

// generate age squared, to capture the nonlinear effect of age 

gen age2=age^2   

// eth -  Ethnicity

* drop eth 
gen eth=1  
replace eth=0 if Q3==1
summarize(eth)  // 1 - ethnic minority, 0 - Han. 


// cpc  - CPC membership


summarize(Q4) 

gen cpc =1
replace  cpc =0 if Q4==2   // 1- communist party member, 0 - otherwise. 
summarize(cpc ) 


// edu - Education level  

* summarize(Q5)    


* drop edu 


gen edu=1 
replace edu=2 if Q5==2 
replace edu=2 if Q5==3 
replace edu=3 if Q5==4 
replace edu=4 if Q5==5 
replace edu=5 if Q5==6 
replace edu=6 if Q5==7  


* add edu labels 

label define edulabel 1 "Middle school and below" 2 "High school/Secondary vocational college"  3 "College"  /// 
4 "Undergraduate"  5 "Postgraduate" 6 "PhD and postdoc",  replace
 
label values edu edulabel


// least educated 

gen leasedu=1 
replace leasedu=0 if Q5>= 2 

 
tab leasedu

* drop undergraduate_above
* drop postgraduate_above
  

gen undergraduate_above=0 
replace undergraduate_above=1 if Q5>=5 

gen postgraduate_above=0 
replace postgraduate_above=1 if Q5>=6 


summarize(undergraduate_above) 
summarize(postgraduate_above)  
 

// Current residence 

gen res= Q17
 
label define Citylabel 1 "Beijing" 2 "Shanghai" 3 "Guangzhou" , replace
 
label values res Citylabel


summarize(res)
tab(res)  


* Beijing/Shanghai/Guangzhou dummies 


gen Shanghai_dum=0 
replace Shanghai_dum=1 if res==2 

gen Guangzhou_dum=0 
replace Guangzhou_dum=1 if res==3 



// Being locals of Beijing/Shanghai/Guangzhou  
// Cohort originally from Beijing/Shanghai/Guangzhou 

gen local=0 
replace local=1 if Q17==Q18 // matching their hometown with their current 
                            // residency
summarize(local) 



label define locallabel 0 "Nonlocal" 1 "Local in Megacity"  , replace
 
label values local locallabel





// Local Hukou 

gen BSG_hukou=0 
replace BSG_hukou=1 if Q20<=3
summarize(BSG_hukou)   

label define BSGlabel 1 "Megacity Hukou Holder" 0 "Non-megacity Hukou Holder", replace
 
label values BSG_hukou BSGlabel


// Naturalized migrants - these are the migrants with BSG Hukou, but are not 
// originally from BSG. 

* drop naturalized_migrants 
gen naturalized_migrants=BSG_hukou  
replace naturalized_migrants=0 if Q17==Q18 
summarize(naturalized_migrants) 

// unnaturalized migrants - those without BSG Hukou 

// gen unnaturalized_migrants=0   
// replace unnaturalized_migrants=1 if BSG_hukou==0  

// summarize(unnaturalized_migrants)  // this is the exact opposite of BSG hukou

 
 // Duration of stay in the current city by December 2018 
 

gen year=real(Q22_Blank1)
summarize(year)

gen month= real(Q22_Blank2)
summarize(month)

gen dur=2018-year+(12-month)/12  
drop year 
drop month 

summarize(dur)

* summarize(age2)  



// gen dif=age-dur  // if any individuals claim they lived in the city longer than
                 // their age, then assign this entry as missing   
// replace dur=0 if dif<=0
// drop dif 
 
 
 // Hukou status 
 
 summarize(Q24)
 
 gen agri_hk_birth=1 
 replace agri_hk_birth=0 if Q24==3 
 
 gen agri_hk_current=0 
 replace agri_hk_current=1  if Q24==1  
 
 summarize(agri_hk_birth) 
 
 summarize(agri_hk_current) 
 
 
 * adding labels 
 /*
label define Hklabel 1 "Agricultural Hukou (Current)" 0 "Non-agricultural Hukou (Current)", replace
label values agri_hk_current Hklabel 
 
tab(agri_hk_current)*/ 

label define Hklabel 1 "Agricultural Hukou" 0 "Non-agricultural Hukou", replace
label values agri_hk_current Hklabel 
 
tab(agri_hk_current)


label define Hklabel_v2 1 "Agricultural Hukou (Birth)" 0 "Non-agricultural Hukou (Birth)", replace
label values agri_hk_birth Hklabel_v2
 
tab(agri_hk_current)
tab(agri_hk_birth)
 
 
 // self-employment 
 
 gen se=0 
 replace se=1 if  Q27_Item1==1
 replace se=1 if Q27_Item2==1
 replace se=1 if Q27_Item3==1 
 
 summarize(se)
 
 // unemployment 
 
summarize(Q27_Item14)  //unemployed 
summarize(Q28_Item1)  // never worked 
summarize (Q27_Item13)  //in full time education 

gen unemp=0 
replace unemp=1 if Q27_Item14==1 
replace  unemp=1 if Q28_Item1==1 & Q27_Item13!=1 // never worked yet not in education
summarize(unemp)  

 // high tech sector 
 
* summarize(Q29) 

* drop high_tech_sec
gen high_tech_sec=0 
replace high_tech_sec=1 if Q29==6 
* replace high_tech_sec=1 if Q29==8 
* replace high_tech_sec=1 if Q29==10 
* replace high_tech_sec=1 if Q29=14 
* replace high_tech_sec=1 if Q30!=9 
 
summarize(high_tech_sec)
summarize(Q30) 
tab(Q30) 


// Senior status  
 
gen senior_status =0 
  
replace senior_status=1 if Q32_Item1==1 // being senior management 
replace senior_status=1 if Q32_Item6==1  // holding senior professional title
 

// Marriage  

 * summarize(Q35) 
 
 gen marr=1 
 replace marr=0 if Q35==1 // unmarried 
 replace marr=0 if Q35==4 //seperated 
 replace marr=0 if Q35==5  //divorced
 replace marr=0 if Q35==6  //widowed
  
 summarize(marr) 
 
 
 // Monthly personal wage 
 
 gen w=Q38_Blank1

 summarize(w)
 
 gen log_w=log(w)
 
 summarize(log_w)  
 
 // estimated monthly wage, if staying at hometown 
 
 gen relative_w_hometown=Q38_Blank1/Q39_Blank1 
 
 summarize(relative_w_hometown) 
 
 
****************************************************************************


// Family size 

gen fz=Q36_Blank1   

summarize(fz)  // number of your close family 

gen fz_v2=Q36_Blank2   

summarize(fz_v2)  // number of your close family members living with you 


// Number of children 

gen num_child=Q37_Blank1   
summarize(Q37_Blank1) 

// Adults in the family 

gen num_adults_family= Q36_Blank2 -num_child 

summarize(num_adults_family) 

replace num_adults_family=1 if num_adults<=1 

summarize(num_adults_family)

 ****************************************************************************  

// self-evalued health level  

gen Health=Q72
summarize(Health)  

label values Health Statlabel  
tab(Health) 

* health dummies 


gen health02=0 
replace health02=1 if Health==2 

gen health03=0 
replace health03=1 if Health==3 

gen health04=0 
replace health04=1 if Health==4 

gen health05=0 
replace health05=1 if Health==5  


// objective health level indicator 

*  drop Health_objective
gen Health_objective= 0
replace Health_objective=1 if Q70==1  // 1 - have visited the doctor for serious health condition 
                                      // 0 - haven't visited the doctor for serious health condition
                                      
summarize(Health_objective)


************************************************* 

// relative income - Q39_Blank1	36. If you stayed at your hometown, what would be your estimated monthly income. _____.


gen w_hometown=  Q39_Blank1 
gen r_hometown =   w /  w_hometown 

summarize r_hometown


// use http://www.stats.gov.cn/tjsj/ndsj/2018/indexch.htm 

// national bureau of statistics 2018 - wage data in 2017 

gen w_beijing= 131700 

gen w_shanghai = 129795 


// guangzhou bureau of statistics 2018 - wage data in 2017 

gen w_guangzhou= 97522  // Number andWages of Employed Persons in Urban Units  in Main Years 
   
 

gen r_BSG =   w / w_beijing 
replace r_BSG=   w / w_shanghai   if res==2 
replace r_BSG =  w / w_guangzhou  if res==3 

summarize r_BSG

 
 
 
 
**************************************    
 
// accommodation type 

 
gen property_owner=0   // houseownders 
replace property_owner=1 if Q42==1
replace property_owner=1 if Q42==2
replace property_owner=1 if Q42==3
replace property_owner=1 if Q42==4 
tab(property_owner) 



gen property_owner_full=0 // full property ownership 
replace property_owner_full=1 if Q42==1
 
replace property_owner_full=1 if Q42==3
 
tab(property_owner_full) 


gen property_owner_mort=0 
 
replace property_owner_mort=1 if Q42==2
 
replace property_owner_mort=1 if Q42==4  

tab(property_owner_mort) 



 
*  drop rented_accom
 
gen rented_accom=0   // rented accommodation 
replace rented_accom=1 if Q42==5
replace rented_accom=1 if Q42==6
replace rented_accom=1 if Q42==7
* replace rented_accom=1 if Q42==8
* replace rented_accom=1 if Q42==9

tab(rented_accom)
 
gen welfare_accom=0 
replace welfare_accom=1 if Q42==8
replace welfare_accom=1 if Q42==9 
 
tab(welfare_accom)
 
gen employer_acomm=0 //accommodation provided by employer 
replace employer_acomm=1 if Q42==10
replace employer_acomm=1 if Q42==11
 
 
 *************************
 
 // treatment as an employee 
 
// Q67_Line1	64. Treatment as an employee. - I can feel the organization's respect for their staff.						
// Q67_Line2	64. Treatment as an employee. - I am satisfied with the organization's operational rules and managerial culture.						
// Q67_Line3	64. Treatment as an employee. - My employer is concerned about the happiness of the staff.						
// Q67_Line4	64. Treatment as an employee. - My employer treats me in the way that I would like to be treated.						
// Q68_Line1	65. Impact of life on private life. - Work seriously affects my private life and takes up personal time.						
// Q68_Line2	65. Impact of life on private life. - My work makes me physiprescally exhausted.						
// Q68_Line3	65. Impact of life on private life. - I felt a lot of pressure on the achievement of my work targets.						
// Q68_Line4	65. Impact of life on private life. - My work has a negative impact on my self-esteem.						



gen respect = Q67_Line1 -1 
 
replace respect=. if respect==0 

tab respect  


gen culture = Q67_Line2-1 
replace culture =. if culture ==0 


gen happiness = Q67_Line3-1 
replace happiness =. if happiness ==0 

gen treatment = Q67_Line4-1 
replace treatment = . if treatment ==0 


gen time = Q68_Line1 -1 
replace time =. if time ==0 
 
gen exhaust =  Q68_Line2 -1 
replace exhaust=. if exhaust==0 

gen pressure = Q68_Line3-1 
replace pressure =. if pressure ==0 

gen esteem = Q68_Line4-1 
replace esteem = . if esteem ==0 


 sum respect culture happiness treatment time exhaust pressure esteem 

 ****************************************
 * adding labels 
 label var w "Monthly income" 
 
   label var log_w "log monthly income" 

  label var r_BSG "Relative income I= monthly income/local monthly income"

  label var r_hometown  "Relative income II = monthly income/expected monthly income if stayed at home locality"

  label var wd "Number of working days per week"

  label var wh "Number of working hours per day" 

  label var senior_status "Whether the individual holds senior managerial position or is a senior professional. (1=yes, 0=no)" 

  label var se "Whether the individual is self-employed. (1=yes, 0=no)" 

  label var respect "I can feel the organization’s respect for their staff" 

  label var culture "I am satisfied with the organization’s operational rules and managerial culture" 

  label var happiness "My employer is concerned about the happiness of the staff" 

  label var treatment "My employer treats me the way he/she would like to be treated" 

  label var exhaust "My work makes me physically exhausted" 

  label var pressure "I feel a lot of pressure on the achievement of my work targets" 

  label var dur "Duration of stay (years) in Beijing/Shanghai/Guangzhou"

  label var job_ref "Number of jobs obtained based on referral from friends and family" 
  
  label var job_num  "Total number of jobs worked" 
  
  label var property_owner_full "Whether the respondent is living in self-owned properties without mortgage. (1=yes, 0=no)" 

  label var rented_accom "Whether the respondent’s family are living in rental accommodation. (1=yes, 0=no)" 

  label var agri_hk_current "Whether the respondent currently possesses an agricultural Hukou. (1=yes, 0=no)" 
label var agri_hk_birth "Whether the respondent possesses an agricultural Hukou before the reform in 2014. (1=yes, 0=no)" 
  label var BSG_hukou "Whether the respondent possesses a Beijing/Shanghai/Guangzhou local Hukou. (1=yes, 0=no)" 

  label var cpc "Respondent being a CPC member. (1=yes, 0=no)" 

  label var PerRef "Proportion of jobs obtained based on referral from friends and family"

  label var sex "Gender of the respondent (1=male, 0=female)" 

  label var age "Age of the respondent by December 2018" 

 

  label var eth "Respondent’s ethnicity (1=ethnic minority, 0=Han)" 

  label var marr "Respondent being married (1=yes, 0=no)" 

  label var edu "Education level of the respondent" 

  label var Health  "Satisfaction with personal health" 


 
 
 
 
 
  **************************************     
// store file 
 
save JobSatisfaction20190206_active_file, replace   



        
**************************************     
 // summary statistics - original dataset 

 
estpost summarize  SatIncome SatSkill SatPotent SatWork  SatOverall  Health  /// 
 w  w_hometown wd wh sex age  cpc eth marr edu   /// 
dur property_owner_full rented_accom  agri_hk_birth agri_hk_current  BSG_hukou local  /// 
 cpc job_num job_ref /// 
respect culture happiness treatment exhaust pressure  
 
 
esttab,  legend label   cells("count mean sd min max") noobs, using JobSatSummaryStatistics.rtf, replace  

 
 
 
 
************************************** 
// test for VIFs - all VIFs suffice 


collin  SatJobOverall   log_w r_BSG  r_hometown   sex age  eth marr edu   ///
senior_status  wd wh se   Health   ///
 dur property_owner_full rented_accom    agri_hk_current BSG_hukou  cpc PerRef /// 
respect culture happiness treatment exhaust pressure

collin  SatIncome   log_w r_BSG  r_hometown   sex age  eth marr edu   ///
senior_status  wd wh se   Health   ///
 dur property_owner_full rented_accom    agri_hk_current BSG_hukou  cpc PerRef /// 
respect culture happiness treatment exhaust pressure

collin  SatSkill   log_w r_BSG  r_hometown   sex age  eth marr edu   ///
senior_status  wd wh se   Health   ///
 dur property_owner_full rented_accom    agri_hk_current BSG_hukou  cpc PerRef /// 
respect culture happiness treatment exhaust pressure


collin  SatPotent   log_w r_BSG  r_hometown   sex age  eth marr edu   ///
senior_status  wd wh se   Health   ///
 dur property_owner_full rented_accom    agri_hk_current BSG_hukou  cpc PerRef /// 
respect culture happiness treatment exhaust pressure


collin  SatWork   log_w r_BSG  r_hometown   sex age  eth marr edu   ///
senior_status  wd wh se   Health   ///
 dur property_owner_full rented_accom    agri_hk_current BSG_hukou  cpc PerRef /// 
respect culture happiness treatment exhaust pressure 


************************************** 
* test for parallel line assumption 

  gologit2 SatJobOverall   log_w r_BSG  r_hometown   sex age  eth marr edu   ///
senior_status  wd wh se   Health   ///
 dur property_owner_full rented_accom    agri_hk_current BSG_hukou  cpc PerRef /// 
respect culture happiness treatment exhaust pressure  ,   pl sto(oprobit) link(p)
  

 gologit2 SatJobOverall   log_w r_BSG  r_hometown   sex age  eth marr edu   ///
senior_status  wd wh se   Health   ///
 dur property_owner_full rented_accom    agri_hk_current BSG_hukou  cpc PerRef /// 
respect culture happiness treatment exhaust pressure , npl sto(goprobit) link(p)
 
 lrtest oprobit goprobit, stats

  gologit2 SatIncome   log_w r_BSG  r_hometown   sex age  eth marr edu   ///
senior_status  wd wh se   Health   ///
 dur property_owner_full rented_accom    agri_hk_current BSG_hukou  cpc PerRef /// 
respect culture happiness treatment exhaust pressure  ,   pl sto(oprobit) link(p)
  

 gologit2 SatIncome   log_w r_BSG  r_hometown   sex age  eth marr edu   ///
senior_status  wd wh se   Health   ///
 dur property_owner_full rented_accom    agri_hk_current BSG_hukou  cpc PerRef /// 
respect culture happiness treatment exhaust pressure , npl sto(goprobit) link(p)
 
 lrtest oprobit goprobit, stats

 
 * okay for skill to be in ordered probit 

   gologit2 SatSkill   log_w r_BSG  r_hometown   sex age  eth marr edu   ///
senior_status  wd wh se   Health   ///
 dur property_owner_full rented_accom    agri_hk_current BSG_hukou  cpc PerRef /// 
respect culture happiness treatment exhaust pressure  ,   pl sto(oprobit) link(p)
  

 gologit2 SatSkill   log_w r_BSG  r_hometown   sex age  eth marr edu   ///
senior_status  wd wh se   Health   ///
 dur property_owner_full rented_accom    agri_hk_current BSG_hukou  cpc PerRef /// 
respect culture happiness treatment exhaust pressure , npl sto(goprobit) link(p)
 
 lrtest oprobit goprobit, stats

    gologit2  SatPotent   log_w r_BSG  r_hometown   sex age  eth marr edu   ///
senior_status  wd wh se   Health   ///
 dur property_owner_full rented_accom    agri_hk_current BSG_hukou  cpc PerRef /// 
respect culture happiness treatment exhaust pressure  ,   pl sto(oprobit) link(p)
  

 gologit2  SatPotent   log_w r_BSG  r_hometown   sex age  eth marr edu   ///
senior_status  wd wh se   Health   ///
 dur property_owner_full rented_accom    agri_hk_current BSG_hukou  cpc PerRef /// 
respect culture happiness treatment exhaust pressure , npl sto(goprobit) link(p)
 
 lrtest oprobit goprobit, stats

 
 
    gologit2  SatWork    log_w r_BSG  r_hometown   sex age  eth marr edu   ///
senior_status  wd wh se   Health   ///
 dur property_owner_full rented_accom    agri_hk_current BSG_hukou  cpc PerRef /// 
respect culture happiness treatment exhaust pressure  ,   pl sto(oprobit) link(p)
  

 gologit2  SatWork   log_w r_BSG  r_hometown   sex age  eth marr edu   ///
senior_status  wd wh se   Health   ///
 dur property_owner_full rented_accom    agri_hk_current BSG_hukou  cpc PerRef /// 
respect culture happiness treatment exhaust pressure , npl sto(goprobit) link(p)
 
 lrtest oprobit goprobit, stats
 

 **************************************  
 
 * recode into binary variables 
 
 gen SatJobOverall_binary = 0 
replace SatJobOverall_binary=1 if SatJobOverall==4
replace SatJobOverall_binary=1 if SatJobOverall==5
   


 gen SatIncome_binary = 0 
replace SatIncome_binary=1 if SatIncome==4 
replace SatIncome_binary=1 if SatIncome==5 


  gen SatSkill_binary = 0 
replace SatSkill_binary=1 if SatSkill==4
replace SatSkill_binary=1 if SatSkill==5
   

  gen SatPotent_binary = 0 
replace SatPotent_binary=1 if SatPotent==4
replace SatPotent_binary=1 if SatPotent==5

  
  gen SatWork_binary = 0 
replace SatWork_binary=1 if SatWork==4
replace SatWork_binary=1 if SatWork==5

   label var SatJobOverall_binary	"Overall job satisfaction"  
  label var SatIncome_binary	"Satisfaction with income"  
  label var SatSkill_binary  "Overall with skill acquisition" 
  label var SatPotent_binary	 "Satisfaction with potential realization"  
  label var SatWork_binary	 "Satisfaction with working condition"  
 
 
 estpost summarize  SatJobOverall_binary SatIncome_binary  SatSkill_binary  SatPotent_binary  SatWork_binary	 /// 
log_w r_BSG  r_hometown job_ref /// 
 
 esttab,      cells("count mean sd min max") noobs, using JobSatSummaryStatistics_new.rtf, replace  

 

**************************************     
 // the cohort of migrants  
 
 
 preserve 
tempfile Migrants  NotMigrants
keep if BSG_hukou ==0   
save "Migrants", replace           




 probit  SatIncome_binary    log_w r_BSG  r_hometown   sex age   eth marr edu   ///
senior_status  wd wh se   Health   ///
 dur property_owner_full rented_accom   cpc PerRef   /// 
respect culture happiness treatment exhaust pressure   , vce(robust) 
 
est sto m1_migrants 


 probit SatSkill_binary     log_w r_BSG  r_hometown   sex age   eth marr edu   ///
senior_status  wd wh se   Health   ///
 dur property_owner_full rented_accom   cpc PerRef  /// 
respect culture happiness treatment exhaust pressure   , vce(robust) 
est sto m2_migrants


 probit SatPotent_binary    log_w r_BSG  r_hometown   sex age   eth marr edu   ///
senior_status  wd wh se   Health   ///
 dur property_owner_full rented_accom   cpc PerRef  /// 
respect culture happiness treatment exhaust pressure   , vce(robust) 
est sto m3_migrants


 probit  SatWork_binary   log_w r_BSG  r_hometown   sex age   eth marr edu   ///
senior_status  wd wh se   Health   ///
 dur property_owner_full rented_accom   cpc PerRef  /// 
respect culture happiness treatment exhaust pressure   , vce(robust)  
est sto m4_migrants 


 probit  SatJobOverall_binary   log_w r_BSG  r_hometown   sex age   eth marr edu   ///
senior_status  wd wh se   Health   ///
 dur property_owner_full rented_accom   cpc PerRef  /// 
respect culture happiness treatment exhaust pressure   , vce(robust) 
est sto m5_migrants 

 
* esttab  m1 m2 m3 m4  m5 , star(* 0.1 ** 0.05 *** 0.01)  scalars(N aic),  using JobSatMigrants_v1.rtf, replace 
restore 



 preserve 
tempfile Migrants  NotMigrants
keep if BSG_hukou ==1   
save "NotMigrants", replace           




 probit  SatIncome_binary    log_w r_BSG  r_hometown   sex age   eth marr edu   ///
senior_status  wd wh se   Health   ///
 dur property_owner_full rented_accom   cpc PerRef   /// 
respect culture happiness treatment exhaust pressure   , vce(robust) 
 
est sto m1_not_migrants


 probit SatSkill_binary     log_w r_BSG  r_hometown   sex age   eth marr edu   ///
senior_status  wd wh se   Health   ///
 dur property_owner_full rented_accom   cpc PerRef  /// 
respect culture happiness treatment exhaust pressure   , vce(robust) 
est sto m2_not_migrants


 probit SatPotent_binary    log_w r_BSG  r_hometown   sex age   eth marr edu   ///
senior_status  wd wh se   Health   ///
 dur property_owner_full rented_accom   cpc PerRef  /// 
respect culture happiness treatment exhaust pressure   , vce(robust) 
est sto m3_not_migrants


 probit  SatWork_binary   log_w r_BSG  r_hometown   sex age   eth marr edu   ///
senior_status  wd wh se   Health   ///
 dur property_owner_full rented_accom   cpc PerRef  /// 
respect culture happiness treatment exhaust pressure   , vce(robust)  
est sto m4_not_migrants


 probit  SatJobOverall_binary   log_w r_BSG  r_hometown   sex age   eth marr edu   ///
senior_status  wd wh se   Health   ///
 dur property_owner_full rented_accom   cpc PerRef  /// 
respect culture happiness treatment exhaust pressure   , vce(robust) 
est sto m5_not_migrants

 
* esttab  m1 m2 m3 m4  m5 , star(* 0.1 ** 0.05 *** 0.01)  scalars(N aic),  using JobSatMigrants_v1.rtf, replace 
restore 





**************************************     
 // the cohort of migrants with non-agricultural Hukou 


 preserve 
tempfile Migrants_non_agri  
keep if BSG_hukou ==0   & agri_hk_current==0
save "Migrants_non_agri", replace           



 probit  SatIncome_binary  log_w r_BSG  r_hometown   sex age   eth marr edu   ///
senior_status  wd wh se   Health   ///
 dur property_owner_full rented_accom   cpc PerRef   /// 
respect culture happiness treatment exhaust pressure   , vce(robust) 
est sto m1_migrants_non_agri  


 probit SatSkill_binary  log_w r_BSG  r_hometown   sex age   eth marr edu   ///
senior_status  wd wh se   Health   ///
 dur property_owner_full rented_accom   cpc PerRef   /// 
respect culture happiness treatment exhaust pressure   , vce(robust) 
est sto m2_migrants_non_agri 


 probit SatPotent_binary  log_w r_BSG  r_hometown   sex age   eth marr edu   ///
senior_status  wd wh se   Health   ///
 dur property_owner_full rented_accom   cpc PerRef  /// 
respect culture happiness treatment exhaust pressure   , vce(robust) 
est sto m3_migrants_non_agri 


 probit  SatWork_binary  log_w r_BSG  r_hometown   sex age   eth marr edu   ///
senior_status  wd wh se   Health   ///
 dur property_owner_full rented_accom   cpc PerRef  /// 
respect culture happiness treatment exhaust pressure   , vce(robust) 
est sto m4_migrants_non_agri  


 probit  SatJobOverall_binary   log_w r_BSG  r_hometown   sex age   eth marr edu   ///
senior_status  wd wh se   Health   ///
 dur property_owner_full rented_accom   cpc PerRef  /// 
respect culture happiness treatment exhaust pressure   , vce(robust) 
est sto m5_migrants_non_agri  

 
* esttab  m1 m2 m3 m4  m5 , star(* 0.1 ** 0.05 *** 0.01)  scalars(N aic),  using JobSatMigrants_non_agri_current.rtf, replace 

  
restore 






// save results 
 


esttab      m5_not_migrants   m5_migrants     m5_migrants_non_agri  /// overall job satisfaction 
 m1_not_migrants  m1_migrants     m1_migrants_non_agri   /// satisfaction with income  
  m3_not_migrants   m3_migrants   m3_migrants_non_agri , /// potential realization 
  mtitles(  "Local Overall job satisfaction"  "Migrants  Overall job satisfaction"    "Migrants with non agricultural Hukou  Overall job satisfaction"   "Local  income satisfaction"  "Migrants  income satisfaction"    "Migrants with non agricultural Hukou income satisfaction" "Local potential realization"  "Migrants  potential realization"    "Migrants with non agricultural Hukou  potential realization"    )  ///
star(* 0.1 ** 0.05 *** 0.01)  scalars(N aic),  using Sat_summary_Hukou_current.rtf, replace 





**************************************     
 // self-employment  
 
 sum edu if se==0 
 sum edu if se==1 
 
 sum edu if BSG_hukou==1 & se==0 
 sum edu if BSG_hukou==1 & se==1  
  sum edu if BSG_hukou==0 & se==0 
  sum edu if BSG_hukou==0 & se==1
  sum edu if agri_hk_current ==1 & se==0 
  sum edu if agri_hk_current ==1 & se==1
  sum edu if agri_hk_current ==0  & se==0 
    sum edu if agri_hk_current ==0  & se==1 

 
   
 // self-employment 
 

probit  se sex age  marr eth dur, vce(robust) // personal information
est sto m1 

probit  se sex  age  marr eth dur edu       ,  vce(robust)  // add working experiences
est sto m2_Hukou_current

* probit  se sex  age  marr eth  edu  agri_hk_birth local     ,  vce(robust)  // add working experiences
*  est sto m3_Hukou_current
 
probit  se sex  age  marr eth dur edu  agri_hk_current BSG_hukou    , vce(robust)   // adding education 
est sto m3_Hukou_current
 
 
   
probit  se sex  age  marr eth edu  agri_hk_current  BSG_hukou  dur   PerRef cpc , vce(robust)  // adding extended social network 
est sto m4_Hukou_current  

  esttab  m1  m2_Hukou_current m3_Hukou_current m4_Hukou_current       , star(* 0.1 ** 0.05 *** 0.01)  scalars(N aic),  using SelfEploymen.rtf, replace 




 
**************************************  
 